/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Admin.java
 *
 * Created on Oct 8, 2011, 5:57:29 PM
 */
package project;

import Utils.Helper;
import Utils.JDBCHelper;
import beanControl.interestControl;
import beanControl.userControl;
import beanInfo.interest;
import beanInfo.users;
import javax.swing.JTextField;

/**
 *
 * @author MiA
 */
public class Admin extends javax.swing.JFrame {

    JDBCHelper jdbc = new JDBCHelper();
   
    userControl use = new userControl();
    users us = new users();
    interestControl inct = new interestControl();
    interest in = new interest();
    String id="";
     public static int  cruUser=0;
     

    /** Creates new form Admin */
    public Admin(String ID) {
        initComponents();
        this.id=ID;

        loadInterst();
        loadCustomer();
        loadUser();
        loadBranches();
        loadPayIn();
        loadPayOriginal();
        loadLoanProfile();
    }

    public void loadInterst() {
        String sql = "select InterestID,UpdateDate,LimitInterset,UnLimitInterest,b.InterrestName,a.Status from Interest a, InterestType b where a.InterestTypeID = b.InterestTypeID";
        String[] header = {"InterestID", "UpdateDate", "LimitInterset", "UnLimitInterest", "InterestTypeID", "Status"};
        Helper.loadDataTable(sql, tblInterest, header);
    }

    public void loadPayOriginal() {
        String sql = "select * from PayOriginal";
        String[] header = {"Term", "PaymentDate", "ProfileID", "PrincipalBalance", "Money", "Status"};
        Helper.loadDataTable(sql, tblPayOriginal, header);

    }

    public void loadPayIn() {
        String sql = "select * from PayInterest";
        String[] header = {"Term", "PaymentDate", "ProfileID", "BalanceInterest", "Money", "Status"};
        Helper.loadDataTable(sql, tblPayInterest, header);
    }

    public void loadUser() {
        String sql = "select UserName, Name, Email,Address,Gender,Roles,Phone, Status from Users";
        String[] header = {"UserName",  "Name", "Email", "Address", "Gender", "Role", "Phone", "Status"};
        Helper.loadDataTable(sql, tblUser, header);
    }

    public void DeleteUser() {
        us.setUserName((Helper.getValueTable(tblUser, 0).toString()));
        use.DeleteUser(us);
    }

//    public void deleteInterest() {
//        in.setInterestID(Integer.parseInt(Helper.getValueTable(tblInterest, 0).toString()));
//        inct.DeleteCategories(in);
//    }
    public void loadBranches() {
        String sql = "select*from Branches";
        String[] header = {"BranchesID", "BranchName", "Address", "Email"};
        Helper.loadDataTable(sql, tblBranches, header);
    }

    public void loadCustomer() {
        String sql ="select CusID,CusName,Gender,Birthday,Identification,IssueDate,PlaceSupply,b.BranchName from Customers a,Branches b where a.BranchesID=b.BranchesID";
                

        String[] header = {"CusID","CusName", "Gender", "Birthday", "Identification", "IssueDate", "PlaceSupply" ,"BranchName"};
        Helper.loadDataTable(sql, tblProfilelcustomer, header);

    }
    public void loadLoanProfile()
    {
        String sql="Select ProfileID,InterestID ,b.CusName,UserName,TotalAmount,DateLoan,LimitInterset from LoanProfile a,Customers b where a.CusID=b.CusID";
        String[] header = {"ProfileID","InterestID", "CusName", "UserName", "TotalAmount","DateLoan", "LimitInterse"};
        Helper.loadDataTable(sql, tblLoanProfile, header);
    }
            
   

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel5 = new javax.swing.JPanel();
        jLabel25 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tblBranches = new javax.swing.JTable();
        jPanel6 = new javax.swing.JPanel();
        jLabel26 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tblInterest = new javax.swing.JTable();
        jLabel35 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        btnAddinterest = new javax.swing.JButton();
        btnUpdateInteres = new javax.swing.JButton();
        btnRefreshInter = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblProfilelcustomer = new javax.swing.JTable();
        jLabel32 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        btnUpdateprofile = new javax.swing.JButton();
        btnRefresh = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblUser = new javax.swing.JTable();
        jLabel14 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        btnAddUser = new javax.swing.JButton();
        btnUpdate = new javax.swing.JButton();
        btnRefreshuser = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        tblPayOriginal = new javax.swing.JTable();
        jPanel8 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        tblPayInterest = new javax.swing.JTable();
        jPanel10 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        tblLoanProfile = new javax.swing.JTable();
        btnRefreshloan = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        jTabbedPane1.setBackground(new java.awt.Color(255, 255, 255));
        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);

        jPanel5.setBackground(new java.awt.Color(255, 255, 255));
        jPanel5.setLayout(null);

        jLabel25.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel5.add(jLabel25);
        jLabel25.setBounds(0, 0, 290, 210);

        jLabel28.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel5.add(jLabel28);
        jLabel28.setBounds(280, 3, 460, 210);

        jLabel36.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel5.add(jLabel36);
        jLabel36.setBounds(750, 10, 310, 200);

        tblBranches.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane4.setViewportView(tblBranches);

        jPanel5.add(jScrollPane4);
        jScrollPane4.setBounds(10, 230, 1040, 240);

        jTabbedPane1.addTab("Branches", new javax.swing.ImageIcon(getClass().getResource("/images/icon/22.jpg")), jPanel5); // NOI18N

        jPanel6.setBackground(new java.awt.Color(255, 255, 255));
        jPanel6.setLayout(null);
        jPanel6.add(jLabel26);
        jLabel26.setBounds(460, 420, 60, 14);

        tblInterest.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane3.setViewportView(tblInterest);

        jPanel6.add(jScrollPane3);
        jScrollPane3.setBounds(10, 210, 1040, 190);

        jLabel35.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel6.add(jLabel35);
        jLabel35.setBounds(820, 0, 270, 200);

        jLabel22.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel6.add(jLabel22);
        jLabel22.setBounds(280, 3, 560, 210);

        jLabel24.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel6.add(jLabel24);
        jLabel24.setBounds(0, 0, 290, 210);

        btnAddinterest.setBackground(new java.awt.Color(0, 102, 102));
        btnAddinterest.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnAddinterest.setForeground(new java.awt.Color(255, 255, 255));
        btnAddinterest.setText("Add new ");
        btnAddinterest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddinterestActionPerformed(evt);
            }
        });
        jPanel6.add(btnAddinterest);
        btnAddinterest.setBounds(10, 400, 120, 50);

        btnUpdateInteres.setBackground(new java.awt.Color(0, 102, 102));
        btnUpdateInteres.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnUpdateInteres.setForeground(new java.awt.Color(255, 255, 255));
        btnUpdateInteres.setText("update");
        btnUpdateInteres.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateInteresActionPerformed(evt);
            }
        });
        jPanel6.add(btnUpdateInteres);
        btnUpdateInteres.setBounds(140, 400, 120, 50);

        btnRefreshInter.setBackground(new java.awt.Color(0, 102, 102));
        btnRefreshInter.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        btnRefreshInter.setForeground(new java.awt.Color(255, 255, 255));
        btnRefreshInter.setText("Refresh");
        btnRefreshInter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRefreshInterActionPerformed(evt);
            }
        });
        jPanel6.add(btnRefreshInter);
        btnRefreshInter.setBounds(270, 403, 90, 50);

        jTabbedPane1.addTab("Interest", new javax.swing.ImageIcon(getClass().getResource("/images/icon/sư.jpg")), jPanel6); // NOI18N

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));
        jPanel3.setLayout(null);

        jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel3.add(jLabel13);
        jLabel13.setBounds(0, 0, 290, 210);

        tblProfilelcustomer.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        tblProfilelcustomer.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblProfilelcustomerMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tblProfilelcustomer);

        jPanel3.add(jScrollPane2);
        jScrollPane2.setBounds(10, 210, 1040, 220);

        jLabel32.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel3.add(jLabel32);
        jLabel32.setBounds(780, 0, 320, 200);

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel3.add(jLabel3);
        jLabel3.setBounds(290, 3, 500, 210);

        jButton1.setBackground(new java.awt.Color(0, 102, 102));
        jButton1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jButton1.setForeground(new java.awt.Color(255, 255, 255));
        jButton1.setText("Add New");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton1);
        jButton1.setBounds(10, 430, 100, 50);

        btnUpdateprofile.setBackground(new java.awt.Color(0, 102, 102));
        btnUpdateprofile.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnUpdateprofile.setForeground(new java.awt.Color(255, 255, 255));
        btnUpdateprofile.setText("Update");
        btnUpdateprofile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateprofileActionPerformed(evt);
            }
        });
        jPanel3.add(btnUpdateprofile);
        btnUpdateprofile.setBounds(120, 430, 110, 50);

        btnRefresh.setBackground(new java.awt.Color(0, 102, 102));
        btnRefresh.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnRefresh.setForeground(new java.awt.Color(255, 255, 255));
        btnRefresh.setText("Refresh");
        btnRefresh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRefreshActionPerformed(evt);
            }
        });
        jPanel3.add(btnRefresh);
        btnRefresh.setBounds(240, 430, 110, 50);

        jTabbedPane1.addTab("Customers", new javax.swing.ImageIcon(getClass().getResource("/images/icon/3232.jpg")), jPanel3); // NOI18N

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setLayout(null);

        tblUser.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        tblUser.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblUserMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblUser);

        jPanel2.add(jScrollPane1);
        jScrollPane1.setBounds(10, 220, 1040, 220);

        jLabel14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel2.add(jLabel14);
        jLabel14.setBounds(0, 0, 290, 210);

        jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel2.add(jLabel12);
        jLabel12.setBounds(280, 3, 450, 210);

        jLabel34.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel2.add(jLabel34);
        jLabel34.setBounds(730, 10, 320, 200);

        btnAddUser.setBackground(new java.awt.Color(0, 102, 102));
        btnAddUser.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnAddUser.setForeground(new java.awt.Color(255, 255, 255));
        btnAddUser.setText("Add New");
        btnAddUser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddUserActionPerformed(evt);
            }
        });
        jPanel2.add(btnAddUser);
        btnAddUser.setBounds(10, 440, 110, 50);

        btnUpdate.setBackground(new java.awt.Color(0, 102, 102));
        btnUpdate.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnUpdate.setForeground(new java.awt.Color(255, 255, 255));
        btnUpdate.setText("Update");
        btnUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateActionPerformed(evt);
            }
        });
        jPanel2.add(btnUpdate);
        btnUpdate.setBounds(140, 440, 110, 50);

        btnRefreshuser.setBackground(new java.awt.Color(0, 102, 102));
        btnRefreshuser.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnRefreshuser.setForeground(new java.awt.Color(255, 255, 255));
        btnRefreshuser.setText("Refresh");
        btnRefreshuser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRefreshuserActionPerformed(evt);
            }
        });
        jPanel2.add(btnRefreshuser);
        btnRefreshuser.setBounds(260, 440, 110, 50);

        jTabbedPane1.addTab("User", new javax.swing.ImageIcon(getClass().getResource("/images/icon/12.png")), jPanel2); // NOI18N

        jPanel4.setLayout(null);

        jPanel7.setBackground(new java.awt.Color(255, 255, 255));
        jPanel7.setLayout(null);

        jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel7.add(jLabel15);
        jLabel15.setBounds(0, 0, 290, 210);

        jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel7.add(jLabel16);
        jLabel16.setBounds(280, 3, 440, 210);

        jLabel37.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel7.add(jLabel37);
        jLabel37.setBounds(730, 10, 320, 200);

        tblPayOriginal.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane5.setViewportView(tblPayOriginal);

        jPanel7.add(jScrollPane5);
        jScrollPane5.setBounds(30, 230, 1010, 330);

        jPanel4.add(jPanel7);
        jPanel7.setBounds(0, 0, 1060, 690);

        jTabbedPane1.addTab("PayOriginal", new javax.swing.ImageIcon(getClass().getResource("/images/icon/sds.jpg")), jPanel4); // NOI18N

        jPanel8.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jPanel8.setLayout(null);

        jPanel9.setBackground(new java.awt.Color(255, 255, 255));
        jPanel9.setLayout(null);

        jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel9.add(jLabel17);
        jLabel17.setBounds(0, 0, 290, 210);

        jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel9.add(jLabel18);
        jLabel18.setBounds(280, 3, 440, 210);

        jLabel38.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel9.add(jLabel38);
        jLabel38.setBounds(730, 10, 320, 200);

        tblPayInterest.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane6.setViewportView(tblPayInterest);

        jPanel9.add(jScrollPane6);
        jScrollPane6.setBounds(40, 220, 980, 320);

        jPanel8.add(jPanel9);
        jPanel9.setBounds(0, 0, 1050, 700);

        jTabbedPane1.addTab("PayInterest", new javax.swing.ImageIcon(getClass().getResource("/images/icon/success.png")), jPanel8); // NOI18N

        jPanel10.setLayout(null);

        jPanel11.setBackground(new java.awt.Color(255, 255, 255));
        jPanel11.setLayout(null);

        jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/6.jpg"))); // NOI18N
        jPanel11.add(jLabel19);
        jLabel19.setBounds(0, 0, 290, 210);

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/9.jpg"))); // NOI18N
        jPanel11.add(jLabel4);
        jLabel4.setBounds(290, 3, 500, 210);

        jLabel33.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon/cash.png"))); // NOI18N
        jPanel11.add(jLabel33);
        jLabel33.setBounds(780, 0, 320, 200);

        tblLoanProfile.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane7.setViewportView(tblLoanProfile);

        jPanel11.add(jScrollPane7);
        jScrollPane7.setBounds(30, 230, 1040, 200);

        btnRefreshloan.setBackground(new java.awt.Color(0, 153, 153));
        btnRefreshloan.setFont(new java.awt.Font("Tahoma", 1, 14));
        btnRefreshloan.setForeground(new java.awt.Color(255, 255, 255));
        btnRefreshloan.setText("Refresh");
        btnRefreshloan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRefreshloanActionPerformed(evt);
            }
        });
        jPanel11.add(btnRefreshloan);
        btnRefreshloan.setBounds(30, 430, 90, 50);

        jPanel10.add(jPanel11);
        jPanel11.setBounds(0, 0, 1097, 680);

        jTabbedPane1.addTab("LoanProfile", new javax.swing.ImageIcon(getClass().getResource("/images/icon/Add.png")), jPanel10); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1234, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 736, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 685, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:

    AddProfileForm pf = new AddProfileForm(id);
    pf.setVisible(true);
}//GEN-LAST:event_jButton1ActionPerformed

private void tblProfilelcustomerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblProfilelcustomerMouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_tblProfilelcustomerMouseClicked

private void btnAddUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddUserActionPerformed
// TODO add your handling code here:
  
     cruUser=0;
     UserFrom us = new UserFrom(id);
    us.setVisible(true);
   
}//GEN-LAST:event_btnAddUserActionPerformed

private void btnAddinterestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddinterestActionPerformed
// TODO add your handling code here:
    InterestPurpos ip = new InterestPurpos(id);
    ip.setVisible(true);
}//GEN-LAST:event_btnAddinterestActionPerformed

private void tblUserMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblUserMouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_tblUserMouseClicked

private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
// TODO add your handling code here:

    int i = tblUser.getSelectedRow();
    if (i != -1) {
        cruUser =1;
        String ID=tblUser.getValueAt(i, 0).toString();
        UserFrom us=new UserFrom(ID);

        us.setVisible(true);
       
    } else {
        Helper.inforMessage("Select User", "Warning !!");
    }
}//GEN-LAST:event_btnUpdateActionPerformed

private void btnUpdateprofileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateprofileActionPerformed
// TODO add your handling code here:
     int i = tblProfilelcustomer.getSelectedRow();
    if (i != -1) {
       
        String ID=tblProfilelcustomer.getValueAt(i, 0).toString();
        AddProfileForm  pro =new  AddProfileForm(ID);
        pro.setVisible(true);
//        cruUser=1;
    }
    else 
    {
        Helper.inforMessage("Select ProfileCustomer"," wanning");
    }
}//GEN-LAST:event_btnUpdateprofileActionPerformed

private void btnUpdateInteresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateInteresActionPerformed
// TODO add your handling code here:
    int i=tblInterest.getSelectedRow();
    if(i!=-1)
    {
         cruUser =1;
        String ID=tblInterest.getValueAt(i, 0).toString();
        InterestPurpos ip = new InterestPurpos(ID);
        ip.setVisible(true);
    }
     else 
    {
        Helper.inforMessage("Select interest"," wanning");
    }
}//GEN-LAST:event_btnUpdateInteresActionPerformed

private void btnRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshActionPerformed
// TODO add your handling code here:
    loadCustomer();
}//GEN-LAST:event_btnRefreshActionPerformed

private void btnRefreshuserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshuserActionPerformed
// TODO add your handling code here:
    loadUser();
}//GEN-LAST:event_btnRefreshuserActionPerformed

private void btnRefreshloanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshloanActionPerformed
// TODO add your handling code here:
    loadLoanProfile();
}//GEN-LAST:event_btnRefreshloanActionPerformed

private void btnRefreshInterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshInterActionPerformed
// TODO add your handling code here:
    loadInterst();
}//GEN-LAST:event_btnRefreshInterActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new Admin().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAddUser;
    private javax.swing.JButton btnAddinterest;
    private javax.swing.JButton btnRefresh;
    private javax.swing.JButton btnRefreshInter;
    private javax.swing.JButton btnRefreshloan;
    private javax.swing.JButton btnRefreshuser;
    private javax.swing.JButton btnUpdate;
    private javax.swing.JButton btnUpdateInteres;
    private javax.swing.JButton btnUpdateprofile;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable tblBranches;
    private javax.swing.JTable tblInterest;
    private javax.swing.JTable tblLoanProfile;
    private javax.swing.JTable tblPayInterest;
    private javax.swing.JTable tblPayOriginal;
    private javax.swing.JTable tblProfilelcustomer;
    private javax.swing.JTable tblUser;
    // End of variables declaration//GEN-END:variables
}
